<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
/**
 * BackendPro
 *
 * A website backend system for developers for PHP 4.3.2 or newer
 *
 * @package         conlabz CMS
 * @author          Christian Schneider
 * @copyright       Copyright (c) 2009
 * @license         
 * @link            http://www.conlabz.de
 * @filesource
 */

// ---------------------------------------------------------------------------

/**
 * Corporate_model
 *
 * @package			conlabz CMS
 * @subpackage		Models
 */
class Corporate_model extends Base_model {
	function Corporate_model( ) {
		parent::Base_model( );
		
		// Cache to store already fetched items
		$this->_TABLES = array( 'Option' => $this->config->item( 'backendpro_table_prefix' ) . 'corporate' );
		
		$this->_CACHE = array( );

		// Object keyword
		// I wouldn't advise changing this, it could corrupt current
		// articles, the reason for needing this is to stop unserialze
		// errors spamming the log files
		$this->object_keyword = "BeP::Object::";

		log_message( 'debug', 'conlabz CMS : Corporate_model class loaded' );
	}

	/**
	 * Get Corporate
	 *
	 * @access public
	 * @return object
	 */
	function getCorporate( ) {
		$this->db->select( 'corporate.website_id,
							corporate.company,
							corporate.extension,
							corporate.name,
							corporate.mail,
							corporate.address,
							corporate.zipcode,
							corporate.city,
							corporate.internet,
							corporate.phone,
							corporate.trade_id,
							corporate.vat_id,
							corporate.information,
							corporate.authorised_representative'
						   );
		$this->db->from( "corporate" );
		$this->db->where( '`corporate`.`website_id`', $this->session->userdata['website_id'] );
		$result = $this->db->get( );
		$row = $result->result_array( );
		return $row[0];
	}
	
	/**
	 * Update Corporate
	 *
	 * @access public
	 */
	function update( $data ) {		
		//update corporate
		$this->db->update( 'corporate', $data, array( 'website_id' => $this->session->userdata['website_id'] ) );	
	}
}
/* End of file corporate_model.php */
/* Location: ./modules/articles/models/corporate_model.php */
